/* Object.prototype.print = function () {
  for (const key in this) {
    // 属性名 in 对象 ：属性是否在对象自身及其隐式原型上
    if (Object.prototype.hasOwnProperty.call(this, key)) {
      const element = this[key];
      console.log(`${key}=${element}`);
    }
  }
};

const obj1 = {
  a: 1,
  b: 2,
};

obj1.print();
 */

// 不使用new创建对象
function User(firstName, lastName) {
  this.firstName = firstName;
  this.lastName = lastName;
}

const u = {};
User.call(u, "z", "s");
console.log(u);
